package com.onlinesys.protocol;

import java.util.HashMap;
import java.util.Map;

public class ConfigManager {
    private static ConfigManager instance = null;
    private Map<String, String> properties = new HashMap<String, String>();

    private ConfigManager() {
        // Load configuration information from DB or file
        // Set values for properties
    }

    public static ConfigManager getInstance() {
        if (instance == null) {
            instance = new ConfigManager();
        }
        return instance;
    }

    public Map<String, String> getProperties() {
        return properties;
    }

    public void setProperties(Map<String, String> properties) {
        this.properties = properties;
    }
    
    public String getConfig(String key, String defaultValue) {
        if (properties.containsKey(key)) {
            return properties.get(key);
        } else {
            return defaultValue;
        }
    }
}